<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;

$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$basic=$this->plugin_setting('basic');
//我的足迹
if($_RQ['op']=='main'){
	$gettype = $_RQ['gettype'];
	$this->session('gettype',$gettype);
	$return['params']=array();
	$return['list']=array();
	exi($return);
}
if($_RQ['op']=='getlist'){
	$gettype = $this->session('gettype');
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if($_RQ['keyword']){
		$params['title like']='%'.$_RQ['keyword'].'%';
		$return['params']['title']=$_RQ['keyword'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;

	$params['mid']=$_SESSION['uid'];
	$zujilist=pdo_getslice('jy_aihire_looklog',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	$list=array();
	if($zujilist){
		foreach($zujilist as &$item){
			$item=pdo_get('jy_aihire_item',array('id'=>$item['itemid'],'uniacid'=>$_SESSION['uniacid']));
			if($item){
				array_push($list,$item);
			}
		}
	}

	if($list){
			$sum=count($list);
			foreach($list as &$item){
				$item['images'] = json_decode($item['images'],true);
				//$item['fileds'] = json_decode($item['fileds'],true);
				$item['price'] =price($item['price']);
				$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
				$item['member']=pdo_get('core_members',array('id'=>$item['mid'],'uniacid'=>$_SESSION['uniacid']),array('credit1','credit2','mobile','avatar','nickname'));
				$item['msgnumn']=pdo_count('jy_aihire_comment',array('uniacid'=>$_SESSION['uniacid'],'itemid'=>$item['id']),'id');
				$item['msg']=pdo_getall('jy_aihire_comment',array('status'=>1,'uniacid'=>$_SESSION['uniacid'],'itemid'=>$item['id']),'','createtime desc');
				if($item['msg']){
					foreach($item['msg'] as &$m){
						$m['createtime'] = date('Y-m-d H:i',$m['createtime']);
						$m['member'] = pdo_get('core_members',array('id'=>$m['mid'],'uniacid'=>$_SESSION['uniacid']),array('credit1','credit2','mobile','avatar','nickname'));
					}
				}
			}
	}
	$return['list']=$list;
	$return['sum']=$sum;
	$return['params']['page'] =$pindex;
	exi($return);
}